import request from '@/utils/request'

// 获取房源列表
export function getPropertyList(params) {
  return request({
    url: '/room/list',
    method: 'get',
    params
  })
}

// 获取所有房源列表
export function getAllRoomList(params) {
  return request({
    url: '/room/all-list',
    method: 'get',
    params
  })
}

// 获取房源详情
export function getPropertyDetail(id) {
  return request({
    url: `/room/getOneById/${id}`,
    method: 'get'
  })
}

// 新增房源
export function addProperty(data) {
  return request({
    url: '/room/insert',
    method: 'post',
    data
  })
}

// 批量拆分房源（一次性提交新房源并删除原房间）
export function splitRooms(data) {
  return request({
    url: '/room/splitBatch',
    method: 'put',
    data
  })
}

// 合并房源
export function mergeRooms(data) {
  return request({
    url: '/room/mergeBatch',
    method: 'put',
    data
  })
}

// 修改房源
export function updateProperty(data) {
  return request({
    url: '/room/update',
    method: 'put',
    data
  })
}

// 删除房源
export function deleteProperty(ids) {
  return request({
    url: `/room/del/${ids}`,
    method: 'delete'
  })
}

// 绑定房间号
export function bindRoom(data) {
  return request({
    url: '/room/bindRoom',
    method: 'post',
    data
  })
}
